X-Git-Url: https://permondes.de/gitweb/Analog_Engine.git/blobdiff_plain/e25ae3805c3f6ab36385c2d04bbf148736184386..4124db17783ef95a2a0020b4a7624b41c0f1b0e5:/scripts/TP1%2004.12%20Harmonic%20Oscillator.LACE?ds=inline diff --git a/scripts/TP1 04.12 Harmonic Oscillator.LACE b/scripts/TP1 04.12 Harmonic Oscillator.LACE new file mode 100644 index 0000000..89b0723 --- /dev/null +++ b/scripts/TP1 04.12 Harmonic Oscillator.LACE @@ -0,0 +1,31 @@ +# Harmonic Oscillator +# A mass m is subject to a force F=-k*r. +# What is the trajectory if the mass starts at position (a,0,0)? +# How much time does it take to pass through zero? +# What is the trajectory if it starts at (a,0,0) with velocity (0,v0,0)? +# Compare to the case including gravity on earth in x direction +# m*x'' = -k*x + g +# m*y'' = -k*y (z can be set to 0). + +coefficient.1(-1) -> -a # (a,0,0), has to be negative because x' is negative +coefficient.2 -> k/m_x # k/m for x +coefficient.3(+1) -> v0 # (0,v0,0), has to be positive because y'' is positive +coefficient.4 -> k/m_y # k/m for y, identical to k/m for x +coefficient.5(-1) -> -g # g + +iintegrate x'' -> -x' +iintegrate -x' -> x + IC: -a +cmultiply (k/m_x, x) -> k/m*x +isum (k/m*x, -g) -> -k/m*x+g +assign (-k/m*x+g) -> x'' + +iintegrate y'' -> -y' + IC: v0 +iintegrate -y' -> y +cmultiply (k/m_y, y) -> k/m*y +invert (k/m*y) -> -k/m*y +assign (-k/m*y) -> y'' + +output x -> out.x +output.y -> out.y